﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Xpus.Website.Core.Membership;
using Xpus.Website.Data;

public partial class Reg : System.Web.UI.Page
{
	protected void Page_Load(object sender, EventArgs e)
	{

	}
	protected void btnRegister_Click(object sender, EventArgs e)
	{
		try
		{
			User u = XpusMembership.CreateUser(
				txtUserName.Text,
				txtPassword.Text,
				txtNickname.Text,
				txtSecurityEmail.Text,
				txtPasswordQuestion.Text,
				txtPasswordAnswer.Text,
				Request.UserHostAddress,
				txtContactEmail.Text);

			if(u == null)
				throw new Exception("创建用户失败了。");

			lblMessage.ForeColor = Color.Green;
			lblMessage.Text = "用户创建成功。";
		}
		catch(Exception ex)
		{
			lblMessage.ForeColor = Color.Red;
			lblMessage.Text = ex.Message;
		}
	}
}
